package com.unicom.office.templateproc;

import com.unicom.office.dataitem.StringDataItem;
import com.unicom.office.runtime.OfficeRuntime;
import com.unicom.office.templatefunc.MultFunc;
import com.unicom.office.type.TypeItem;
import com.unicom.office.type.WorkbookTypeItem;
import com.unicom.office.unit.OfficeUnit;
import com.unicom.office.unit.RootUnit;

import java.util.List;

public class ExcelFilepathProc extends TemplateProc {
    public static final ExcelFilepathProc INSTANCE = new ExcelFilepathProc();

    private ExcelFilepathProc(){}

    public void run(OfficeUnit unit, List<Object> params, OfficeRuntime officeRuntime) {
        StringDataItem filepath = (StringDataItem) params.get(0);
        RootUnit rootUnit = (RootUnit) unit;
        rootUnit.setFilePath(filepath.getValue());
    }

    public String getName() {
        return "excelFilePath";
    }

    public TypeItem getType() {
        return WorkbookTypeItem.INSTANCE;
    }
}
